package phoneBook;

import arcademis.server.AlreadyBoundException;
import br.unifor.mia.cd.middleware.rme2.RmeConfigurator;
import br.unifor.mia.cd.middleware.rme2.naming.RmeNaming;

public class Server {

	public static void main(String args[]) {
		if(args.length != 0) {
			System.err.println("Sintaxe: java PhoneBook objName fileName");
			System.exit(1);
		}
		else {
			try {
				RmeConfigurator c = new RmeConfigurator();
				c.configure();

				PhoneBook o = new PhoneBook();
				RmeNaming.bind("phoneBook", o);
				o.activate();
				o.readFile("list.txt");
			} catch (arcademis.ArcademisException e) {
				e.printStackTrace();
			} catch (arcademis.concreteComponents.MalformedURLException e) {
				e.printStackTrace();
			} catch (AlreadyBoundException e) {
				e.printStackTrace();
			} catch (java.io.IOException e) {
				e.printStackTrace();
			}
		}
	}
}